home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / ini5 / frmini.frm (.txt) next >
Encoding:
Visual Basic Form  |  1997-08-27  |  3.3 KB  |  115 lines

  1. VERSION 5.00
  2. Begin VB.Form frmini 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Sample INI program"
  5.    ClientHeight    =   2625
  6.    ClientLeft      =   3225
  7.    ClientTop       =   4530
  8.    ClientWidth     =   4890
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    PaletteMode     =   1  'UseZOrder
  13.    ScaleHeight     =   2625
  14.    ScaleWidth      =   4890
  15.    StartUpPosition =   2  'CenterScreen
  16.    Begin VB.TextBox Keyname 
  17.       Height          =   285
  18.       Left            =   120
  19.       TabIndex        =   4
  20.       Top             =   720
  21.       Width           =   2295
  22.    End
  23.    Begin VB.TextBox appname 
  24.       Height          =   285
  25.       Left            =   120
  26.       TabIndex        =   3
  27.       Top             =   360
  28.       Width           =   4695
  29.    End
  30.    Begin VB.TextBox txtvalue 
  31.       Height          =   285
  32.       Left            =   2520
  33.       TabIndex        =   2
  34.       Top             =   720
  35.       Width           =   2295
  36.    End
  37.    Begin VB.CommandButton cmdget 
  38.       Caption         =   "Recall"
  39.       Height          =   375
  40.       Left            =   120
  41.       TabIndex        =   1
  42.       Top             =   2160
  43.       Width           =   4695
  44.    End
  45.    Begin VB.CommandButton cmdstore 
  46.       Caption         =   "Store"
  47.       Height          =   375
  48.       Left            =   120
  49.       TabIndex        =   0
  50.       Top             =   1680
  51.       Width           =   4695
  52.    End
  53.    Begin VB.Label Label3 
  54.       Caption         =   "Value"
  55.       Height          =   255
  56.       Left            =   3480
  57.       TabIndex        =   7
  58.       Top             =   1080
  59.       Width           =   495
  60.    End
  61.    Begin VB.Label Label2 
  62.       Caption         =   "Setting"
  63.       Height          =   255
  64.       Left            =   960
  65.       TabIndex        =   6
  66.       Top             =   1080
  67.       Width           =   615
  68.    End
  69.    Begin VB.Label Label1 
  70.       Caption         =   "Heading"
  71.       Height          =   255
  72.       Left            =   1920
  73.       TabIndex        =   5
  74.       Top             =   0
  75.       Width           =   735
  76.    End
  77. Attribute VB_Name = "frmini"
  78. Attribute VB_GlobalNameSpace = False
  79. Attribute VB_Creatable = False
  80. Attribute VB_PredeclaredId = True
  81. Attribute VB_Exposed = False
  82. Option Explicit
  83. Dim IniFileName As String
  84. Private Sub cmdget_Click()
  85. Dim X As Long
  86. Dim Temp As String * 50
  87. Dim lpAppName As String, lpKeyName As String, lpDefault As String, lpFileName As String
  88. lpAppName = appname.Text
  89. lpKeyName = Keyname.Text
  90. lpDefault = file
  91. lpFileName = file
  92. X = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, Temp, Len(Temp), lpFileName)
  93. If X = 0 Then
  94.     Beep
  95.     txtvalue.Text = Trim(Temp)
  96. End If
  97. End Sub
  98. Private Sub cmdstore_Click()
  99. Dim lpAppName As String, lpFileName As String, lpKeyName As String, lpString As String
  100. Dim U As Long
  101. lpAppName = appname.Text
  102. lpKeyName = Keyname.Text
  103. lpString = txtvalue.Text
  104. lpFileName = file
  105. U = WritePrivateProfileString(lpAppName, lpKeyName, lpString, lpFileName)
  106. If U = 0 Then
  107. End If
  108. End Sub
  109. Private Sub Form_Initialize()
  110.     IniFileName = file
  111. End Sub
  112. Private Sub Form_Load()
  113. file = InputBox("Which file do you want to read/edit/create?")
  114. End Sub
  115.